home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / grapdrvs / xsbdraw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-23  |  21.0 KB  |  585 lines

  1. /*****************************************************************************
  2. *   An HP Starbase low level drawing routines.                     *
  3. *                                         *
  4. * Written by:  Gershon Elber                Ver 0.1, June 1994.  *
  5. *****************************************************************************/
  6.  
  7. #include <starbase.c.h>
  8.  
  9. #include <X11/Xlib.h>
  10. #include <X11/Xutil.h>
  11. #include <X11/XHPlib.h>
  12. #include <X11/cursorfont.h>
  13. #include <X11/Xresource.h>
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <math.h>
  18. #include <ctype.h>
  19. #include "irit_sm.h"
  20. #include "attribut.h"
  21. #include "genmat.h"
  22. #include "cagd_lib.h"
  23. #include "symb_lib.h"
  24. #include "iritgrap.h"
  25. #include "x11drvs.h"
  26. #include "xsbdrvs.h"
  27.  
  28. #define MAX_NUM_OF_VERTICES    1000
  29. #define PRGM_TITLE        "xsbmdrvs"
  30.  
  31. long
  32.     ViewWinID = 0,
  33.     ViewWinWidth = 100,
  34.     ViewWinWidth2 = 50,
  35.     ViewWinHeight = 100,
  36.     ViewWinHeight2 = 50,
  37.     ViewWinLow = 0,
  38.     ViewWinLeft = 0;
  39. static int
  40.     GlblFilDes = -1;
  41.  
  42. static short Colors[IG_MAX_COLOR + 1][3] =
  43. {
  44.     { 0,   0,   0   },  /* 0. BLACK */
  45.     { 0,   0,   170 },  /* 1. BLUE */
  46.     { 0,   170, 0   },  /* 2. GREEN */
  47.     { 0,   170, 170 },  /* 3. CYAN */
  48.     { 170, 0,   0   },  /* 4. RED */
  49.     { 170, 0,   170 },  /* 5. MAGENTA */
  50.     { 170, 170, 0   },  /* 6. BROWN */
  51.     { 170, 170, 170 },  /* 7. LIGHTGREY */
  52.     { 85,  85,  85  },  /* 8. DARKGRAY */
  53.     { 85,  85,  255 },  /* 9. LIGHTBLUE */
  54.     { 85,  255, 85  },  /* 10. LIGHTGREEN */
  55.     { 85,  255, 255 },  /* 11. LIGHTCYAN */
  56.     { 255, 85,  85  },  /* 12. LIGHTRED */
  57.     { 255, 85,  255 },  /* 13. LIGHTMAGENTA */
  58.     { 255, 255, 85  },  /* 14. YELLOW */
  59.     { 255, 255, 255 }   /* 15. WHITE */
  60. };
  61.  
  62. static void SetColorIndex(int c);
  63. static void SetColorRGB(int Color[3]);
  64. static void ClearViewArea(void);
  65.  
  66. /*****************************************************************************
  67. * DESCRIPTION:                                                               M
  68. * Draw a single Point/Vector object using current modes and transformations. M
  69. *                                                                            *
  70. * PARAMETERS:                                                                M
  71. *   PObj:     A point/vector object to draw.                                 M
  72. *                                                                            *
  73. * RETURN VALUE:                                                              M
  74. *   void                                                                     M
  75. *                                                                            *
  76. * KEYWORDS:                                                                  M
  77. *   IGDrawPtVec                                                              M
  78. *****************************************************************************/
  79. void IGDrawPtVec(IPObjectStruct *PObj)
  80. {
  81.     int i;
  82.     PointType Ends[6], Zero;
  83.     RealType
  84.     *Pt = PObj -> U.Pt;
  85.  
  86.     for (i = 0; i < 6; i++)
  87.     PT_COPY(Ends[i], Pt);
  88.  
  89.     Ends[0][0] -= IG_POINT_WIDTH;
  90.     Ends[1][0] += IG_POINT_WIDTH;
  91.     Ends[2][1] -= IG_POINT_WIDTH;
  92.     Ends[3][1] += IG_POINT_WIDTH;
  93.     Ends[4][2] -= IG_POINT_WIDTH;
  94.     Ends[5][2] += IG_POINT_WIDTH;
  95.  
  96.     for (i = 0; i < 6; i += 2) {
  97.     move3d(GlblFilDes, Ends[i][0], Ends[i][1], Ends[i][2]);
  98.     draw3d(GlblFilDes, Ends[i+1][0], Ends[i+1][1], Ends[i+1][2]);
  99.     }
  100.  
  101.     if (IP_IS_VEC_OBJ(PObj)) {
  102.     move3d(GlblFilDes, 0.0, 0.0, 0.0);
  103.     draw3d(GlblFilDes, Pt[0], Pt[1], Pt[2]);
  104.     }
  105. }
  106.  
  107. /*****************************************************************************
  108. * DESCRIPTION:                                                               M
  109. * Draw a single Poly object using current modes and transformations.         M
  110. *                                                                            *
  111. * PARAMETERS:                                                                M
  112. *   PObj:     A poly object to draw.                                         M
  113. *                                                                            *
  114. * RETURN VALUE:                                                              M
  115. *   void                                                                     M
  116. *                                                                            *
  117. * KEYWORDS:                                                                  M
  118. *   IGDrawPoly                                                               M
  119. *****************************************************************************/
  120. void IGDrawPoly(IPObjectStruct *PObj)
  121. {
  122.     IPVertexStruct *V;
  123.     IPPolygonStruct
  124.     *Pl = PObj -> U.Pl;
  125.  
  126.     if (Pl -> PAux == NULL) {
  127.     /* Initialize this object's star base data. */
  128.     for (; Pl != NULL; Pl = Pl -> Pnext) {
  129.         float *r, *r2;
  130.         int i = 0,
  131.         Len = IritPrsrVrtxListLen(Pl -> PVertex);
  132.  
  133.         r2 = r = (float *) IritMalloc(1 + sizeof(float) * Len * 6);
  134.  
  135.         *((int *) r2) = Len;
  136.         r2++;
  137.  
  138.         for (V = Pl -> PVertex; V != NULL; V = V -> Pnext) {
  139.         *r2++ = V -> Coord[0];
  140.         *r2++ = V -> Coord[1];
  141.         *r2++ = V -> Coord[2];
  142.         *r2++ = V -> Normal[0];
  143.         *r2++ = V -> Normal[1];
  144.         *r2++ = V -> Normal[2];
  145.         }
  146.  
  147.         Pl -> PAux = r;
  148.     }
  149.  
  150.     Pl = PObj -> U.Pl;
  151.     }
  152.  
  153.     if (IP_IS_POLYLINE_OBJ(PObj)) {
  154.     for (; Pl != NULL; Pl = Pl -> Pnext) {
  155.         float
  156.         *r = (float *) Pl -> PAux;
  157.  
  158.         polyline3d(GlblFilDes, &r[1], *((int *) r), FALSE);
  159.     }
  160.     }
  161.     else if (IP_IS_POINTLIST_OBJ(PObj)) {
  162.     for (; Pl != NULL; Pl = Pl -> Pnext) {
  163.         for (V = Pl -> PVertex; V != NULL; V = V -> Pnext) {
  164.         int i;
  165.         PointType Ends[6];
  166.         RealType
  167.             *Pt = V -> Coord;
  168.  
  169.         for (i = 0; i < 6; i++)
  170.             PT_COPY(Ends[i], Pt);
  171.  
  172.         Ends[0][0] -= IG_POINT_WIDTH;
  173.         Ends[1][0] += IG_POINT_WIDTH;
  174.         Ends[2][1] -= IG_POINT_WIDTH;
  175.         Ends[3][1] += IG_POINT_WIDTH;
  176.         Ends[4][2] -= IG_POINT_WIDTH;
  177.         Ends[5][2] += IG_POINT_WIDTH;
  178.  
  179.         for (i = 0; i < 6; i += 2) {
  180.             move3d(GlblFilDes,
  181.                Ends[i][0], Ends[i][1], Ends[i][2]);
  182.             draw3d(GlblFilDes,
  183.                Ends[i+1][0], Ends[i+1][1], Ends[i+1][2]);
  184.         }
  185.         }
  186.     }
  187.     }
  188.     else if (IP_IS_POLYGON_OBJ(PObj)) {
  189.     int i, j,
  190.         NumOfVertices;
  191.     PointType PNormal, VNormal;
  192.  
  193.     for (; Pl != NULL; Pl = Pl -> Pnext) {
  194.         if (IGGlblBackFaceCull) {
  195.             RealType P1[3], P2[3];
  196.  
  197.         MatMultVecby4by4(P1, Pl -> PVertex -> Coord,
  198.                  IritPrsrViewMat);
  199.         PT_ADD(PNormal, Pl -> PVertex -> Coord, Pl -> Plane);
  200.         MatMultVecby4by4(P2, PNormal, IritPrsrViewMat);
  201.         if (P2[2] - P1[2] > 0.0)
  202.             continue;
  203.         }
  204.  
  205.         if (IGGlblDrawPNormal) {
  206.         NumOfVertices = 0;
  207.         PNormal[0] = PNormal[1] = PNormal[2] = 0.0;
  208.         }
  209.  
  210.         if (IGGlblDrawSolid) {
  211.         float
  212.             *r = (float *) Pl -> PAux;
  213.  
  214.         polygon3d(GlblFilDes, &r[1], *((int *) r), FALSE);
  215.         }
  216.         else {
  217.         int NextMove = TRUE;
  218.         RealType
  219.             *R = Pl -> PVertex -> Coord;
  220.  
  221.         move3d(GlblFilDes, R[0], R[1], R[2]);
  222.  
  223.         for (V = Pl -> PVertex; V != NULL; V = V -> Pnext) {
  224.             R = V -> Coord;
  225.             if (NextMove)
  226.                 move3d(GlblFilDes, R[0], R[1], R[2]);
  227.             else
  228.                 draw3d(GlblFilDes, R[0], R[1], R[2]);
  229.  
  230.             NextMove = IP_IS_INTERNAL_VRTX(V) && !IGGlblDrawInternal;
  231.  
  232.             if (IGGlblDrawPNormal) {
  233.             for (j = 0; j < 3; j++)
  234.                 PNormal[j] += V -> Coord[j];
  235.             NumOfVertices++;
  236.             }
  237.         }
  238.         if (!NextMove) {
  239.             R = Pl -> PVertex -> Coord;
  240.             draw3d(GlblFilDes, R[0], R[1], R[2]);
  241.         }
  242.         }
  243.  
  244.         if (IGGlblDrawPNormal && IP_HAS_PLANE_POLY(Pl)) {
  245.         for (i = 0; i < 3; i++)
  246.             PNormal[i] /= NumOfVertices;
  247.         move3d(GlblFilDes, PNormal[0], PNormal[1], PNormal[2]);
  248.         for (i = 0; i < 3; i++)
  249.             PNormal[i] += Pl -> Plane[i] * IGGlblNormalLen;
  250.         draw3d(GlblFilDes, PNormal[0], PNormal[1], PNormal[2]);
  251.         }
  252.  
  253.         if (IGGlblDrawVNormal) {
  254.         for (V = Pl -> PVertex; V != NULL; V = V -> Pnext) {
  255.             if (IP_HAS_NORMAL_VRTX(V)) {
  256.             for (j = 0; j < 3; j++)
  257.                 VNormal[j] = V -> Coord[j] +
  258.                          V -> Normal[j] * IGGlblNormalLen;
  259.             move3d(GlblFilDes,
  260.                    V -> Coord[0], V -> Coord[1], V -> Coord[2]);
  261.             draw3d(GlblFilDes, VNormal[0], VNormal[1], VNormal[2]);
  262.             }
  263.         }
  264.         }
  265.     }
  266.     }
  267. }
  268.  
  269. /*****************************************************************************
  270. * DESCRIPTION:                                                               M
  271. * Sets the color of an object according to its color/rgb attributes.         M
  272. *   If object has an RGB attribute it will be used. Otherwise, if the object M
  273. * has a COLOR attribute it will use. Otherwise, WHITE will be used.         M
  274. *                                                                            *
  275. * PARAMETERS:                                                                M
  276. *   PObj:      To set the drawing color to its color.                        M
  277. *                                                                            *
  278. * RETURN VALUE:                                                              M
  279. *   void                                                                     M
  280. *                                                                            *
  281. * KEYWORDS:                                                                  M
  282. *   IGSetColorObj                                                            M
  283. *****************************************************************************/
  284. void IGSetColorObj(IPObjectStruct *PObj)
  285. {
  286.     int c, Color[3];
  287.  
  288.     if (AttrGetObjectRGBColor(PObj, &Color[0], &Color[1], &Color[2])) {
  289.     SetColorRGB(Color);
  290.     }
  291.     else if ((c = AttrGetObjectColor(PObj)) != IP_ATTR_NO_COLOR) {
  292.     SetColorIndex(c);
  293.     }
  294.     else {
  295.     /* Use white as default color: */
  296.     SetColorIndex(IG_IRIT_WHITE);
  297.     }
  298. }
  299.  
  300. /*****************************************************************************
  301. * DESCRIPTION:                                                               M
  302. * Sets the line width to draw the given object, in pixels.             M
  303. *                                                                            *
  304. * PARAMETERS:                                                                M
  305. *   Width:    In pixels of lines to draw with.                               M
  306. *                                                                            *
  307. * RETURN VALUE:                                                              M
  308. *   void                                                                     M
  309. *                                                                            *
  310. * KEYWORDS:                                                                  M
  311. *   IGSetWidthObj                                                            M
  312. *****************************************************************************/
  313. void IGSetWidthObj(int Width)
  314. {
  315.     /* This is another "feature" of starbase. The line_width routine only */
  316.     /* works for draw2d and not for draw3d, so this has no affect.      */
  317.     line_endpoint(GlblFilDes, ROUNDED);
  318.     line_width(GlblFilDes, Width / 100.0, MC_UNITS);
  319. }
  320.  
  321. /*****************************************************************************
  322. * DESCRIPTION:                                                               *
  323. * Sets the color according to the given color index.                     *
  324. *                                                                            *
  325. * PARAMETERS:                                                                *
  326. *   color:     Index of color to use. Must be between 0 and IG_MAX_COLOR.    *
  327. *                                                                            *
  328. * RETURN VALUE:                                                              *
  329. *   void                                                                     *
  330. *****************************************************************************/
  331. static void SetColorIndex(int color)
  332. {
  333.     int Color[3];
  334.  
  335.     if (color < 0 || color > IG_MAX_COLOR)
  336.         color = IG_IRIT_WHITE;
  337.  
  338.     Color[0] = Colors[color][0];
  339.     Color[1] = Colors[color][1];
  340.     Color[2] = Colors[color][2];
  341.  
  342.     SetColorRGB(Color);
  343. }
  344.  
  345. /*****************************************************************************
  346. * DESCRIPTION:                                                               *
  347. * Sets the color according to the given RGB values.                 *
  348. *                                                                            *
  349. * PARAMETERS:                                                                *
  350. *   Color:      An RGB vector of integer values between 0 and 255.           *
  351. *                                                                            *
  352. * RETURN VALUE:                                                              *
  353. *   void                                                                     *
  354. *****************************************************************************/
  355. static void SetColorRGB(int Color[3])
  356. {
  357.     line_color(GlblFilDes,
  358.            Color[0] / 255.0, Color[1] / 255.0, Color[2] / 255.0);
  359.     fill_color(GlblFilDes,
  360.            Color[0] / 255.0, Color[1] / 255.0, Color[2] / 255.0);
  361. }
  362.  
  363. /*****************************************************************************
  364. * DESCRIPTION:                                                               *
  365. * Clears the viewing area.                             *
  366. *                                                                            *
  367. * PARAMETERS:                                                                *
  368. *   None                                                                     *
  369. *                                                                            *
  370. * RETURN VALUE:                                                              *
  371. *   void                                                                     *
  372. *****************************************************************************/
  373. static void ClearViewArea(void)
  374. {
  375.     SetColorRGB(IGGlblBackGroundColor);
  376.     if (IGGlblDrawSolid)
  377.     clear_control(GlblFilDes, CLEAR_DISPLAY_SURFACE | CLEAR_ZBUFFER);
  378.     else
  379.     clear_control(GlblFilDes, CLEAR_DISPLAY_SURFACE);
  380.     clear_view_surface(GlblFilDes);
  381.  
  382.     hidden_surface(GlblFilDes, FALSE, FALSE);
  383.     if (IGGlblDoDoubleBuffer)
  384.     double_buffer(GlblFilDes, TRUE | INIT , 24);
  385.     else
  386.     double_buffer(GlblFilDes, FALSE , 24);
  387.     vdc_extent(GlblFilDes, -1.0, -1.0, IGGlblZMinClip,
  388.                     1.0,  1.0, IGGlblZMaxClip);
  389.     clip_depth(GlblFilDes, IGGlblZMaxClip, IGGlblZMinClip);
  390.     depth_indicator(GlblFilDes, TRUE, TRUE);
  391.  
  392.     shade_mode(GlblFilDes, INIT | CMAP_FULL, IGGlblDrawSolid);
  393.     hidden_surface(GlblFilDes, IGGlblDrawSolid, IGGlblBackFaceCull);
  394. }
  395.  
  396. /*****************************************************************************
  397. * DESCRIPTION:                                                               M
  398. * Sets up a view window.                             M
  399. *                                                                            *
  400. * PARAMETERS:                                                                M
  401. *   argc, argv:   Command line.                             M
  402. *                                                                            *
  403. * RETURN VALUE:                                                              M
  404. *   void                                                                     M
  405. *                                                                            *
  406. * KEYWORDS:                                                                  M
  407. *   SetViewWindow                                                            M
  408. *****************************************************************************/
  409. void SetViewWindow(int argc, char **argv)
  410. {
  411.     char *SBDevice;
  412.     float CrntView[4][4];
  413.     int i, j, transparentOverlays, numOverlayVisuals, numVisuals,
  414.     numImageVisuals, imageDepthToUse, mustFreeImageColormap;
  415.     OverlayInfo    *pOverlayVisuals;
  416.     XVisualInfo    *pVisuals, **pImageVisuals, *pPseudoColorVisualInfo,
  417.     *pGrayScaleVisualInfo;
  418.     Visual    *pImageVisualToUse;
  419.     Colormap    imageColormap;
  420.  
  421.     if (!ViewHasSize) {
  422.     ViewWidth = DEFAULT_VIEW_WIDTH;
  423.     ViewHeight = DEFAULT_VIEW_HEIGHT;
  424.     }
  425.     if (!ViewHasPos) {
  426.     ViewPosX = 0;
  427.     ViewPosY = 0;
  428.     }
  429.  
  430.     /* Get all of the visual information about the screen: */
  431.     if (GetXVisualInfo(XDisplay, XScreen, &transparentOverlays,
  432.                &numVisuals, &pVisuals,
  433.                &numOverlayVisuals, &pOverlayVisuals,
  434.                &numImageVisuals, &pImageVisuals))
  435.     {
  436.     fprintf(stderr, "Could not get visual info.\n");
  437.     exit(1);
  438.     }
  439.  
  440.     /* Find an appropriate image planes visual: */
  441.     if (FindImagePlanesVisual(XDisplay, XScreen, numImageVisuals,
  442.                   pImageVisuals, 1, 8, 1, &pImageVisualToUse,
  443.                   &imageDepthToUse))
  444.     {
  445.     fprintf(stderr, "Could not find a good image planes visual.\n");
  446.     exit(1);
  447.     }
  448.  
  449.     if (CreateImagePlanesWindow(XDisplay, XScreen,
  450.                 RootWindow(XDisplay, XScreen),
  451.                 ViewPosX, ViewPosY, ViewWidth, ViewHeight,
  452.                 imageDepthToUse, pImageVisualToUse,
  453.                 argc, argv, PRGM_TITLE, PRGM_TITLE,
  454.                 &ViewWndw, &imageColormap,
  455.                 &mustFreeImageColormap))
  456.     {
  457.     fprintf(stderr, "Could not create the image planes window.\n");
  458.     exit(1);
  459.     }
  460.  
  461.     /* Map the windows: */
  462.     XMapWindow(XDisplay, ViewWndw);
  463.     XSync(XDisplay, FALSE);
  464.     XInstallColormap(XDisplay, imageColormap);
  465.     XSync(XDisplay, FALSE);
  466.  
  467.     XSelectInput(XDisplay, ViewWndw,
  468.          ExposureMask | ResizeRedirectMask | ButtonPressMask);
  469.     XFlush(XDisplay);
  470.  
  471.     SBDevice = make_X11_gopen_string(XDisplay, ViewWndw);
  472.     GlblFilDes = gopen(SBDevice, OUTDEV, "", INIT | THREE_D | MODEL_XFORM);
  473.  
  474.     for (i = 0; i < 4; i++)
  475.         for (j = 0; j < 4; j++)
  476.         CrntView[i][j] = i == j;
  477.     concat_transformation3d(GlblFilDes, CrntView, PRE, PUSH);
  478.  
  479.     light_ambient(GlblFilDes, 0.3, 0.3, 0.3);
  480.     light_source(GlblFilDes, 1, DIRECTIONAL, 0.7, 0.7, 0.7,
  481.          IGGlblLightSrcPos[0], IGGlblLightSrcPos[1],
  482.          IGGlblLightSrcPos[2]);
  483.     light_source(GlblFilDes, 2, DIRECTIONAL, 0.7, 0.7, 0.7,
  484.          -IGGlblLightSrcPos[0], -IGGlblLightSrcPos[1],
  485.          -IGGlblLightSrcPos[2]);
  486.     light_switch(GlblFilDes, 1 + 2 + 4);
  487.  
  488.     vdc_extent(GlblFilDes, -1.0, -1.0, IGGlblZMinClip,
  489.                     1.0,  1.0, IGGlblZMaxClip);
  490.     clip_depth(GlblFilDes, IGGlblZMaxClip, IGGlblZMinClip);
  491.     depth_indicator(GlblFilDes, TRUE, TRUE);
  492.  
  493.     background_color(GlblFilDes, IGGlblBackGroundColor[0] / 255.0,
  494.                           IGGlblBackGroundColor[1] / 255.0,
  495.                  IGGlblBackGroundColor[2] / 255.0);
  496.  
  497.     interior_style(GlblFilDes, INT_SOLID, FALSE);
  498.  
  499.     shade_mode(GlblFilDes, INIT | CMAP_FULL, IGGlblDrawSolid);
  500.  
  501.     vertex_format(GlblFilDes, 3, 3, 0, FALSE,
  502.           COUNTER_CLOCKWISE | UNIT_NORMALS);
  503.  
  504.     ClearViewArea();
  505. }
  506.  
  507. /*****************************************************************************
  508. * DESCRIPTION:                                                               M
  509. * Redraws the view window.                             M
  510. *                                                                            *
  511. * PARAMETERS:                                                                M
  512. *   None                                                                     M
  513. *                                                                            *
  514. * RETURN VALUE:                                                              M
  515. *   void                                                                     M
  516. *                                                                            *
  517. * KEYWORDS:                                                                  M
  518. *   IGRedrawViewWindow                                                       M
  519. *****************************************************************************/
  520. void IGRedrawViewWindow(void)
  521. {
  522.     static int
  523.     CurrentDisplay = 0;
  524.     MatrixType IritView, IritCrntView;
  525.     IPObjectStruct *PObj, *MatObj;
  526.     float CrntView[4][4];
  527.     int i, j, k;
  528.  
  529.     ClearViewArea();
  530.  
  531.     switch (IGGlblViewMode) {         /* Update the current view. */
  532.     case IG_VIEW_ORTHOGRAPHIC:
  533.         GEN_COPY(IritView, IritPrsrViewMat, sizeof(MatrixType));
  534.         break;
  535.     case IG_VIEW_PERSPECTIVE:
  536.         MatMultTwo4by4(IritView, IritPrsrViewMat, IritPrsrPrspMat);
  537.         break;
  538.     }
  539.  
  540.     for (PObj = IGGlblDisplayList; PObj != NULL; PObj = PObj -> Pnext) {
  541.     if ((MatObj = AttrGetObjectObjAttrib(PObj, "_animation_mat"))
  542.                                 != NULL &&
  543.         IP_IS_MAT_OBJ(MatObj) &&
  544.         AttrGetObjectIntAttrib(PObj, "_isvisible")) {
  545.         MatMultTwo4by4(IritCrntView,
  546.                *MatObj -> U.Mat, IritPrsrViewMat);
  547.         if (IGGlblViewMode == IG_VIEW_PERSPECTIVE) 
  548.             MatMultTwo4by4(IritCrntView,
  549.                    IritCrntView, IritPrsrPrspMat);
  550.     }
  551.     else
  552.         GEN_COPY(IritCrntView, IritView, sizeof(MatrixType));
  553.  
  554.     for (i = 0; i < 4; i++)
  555.         for (j = 0; j < 4; j++)
  556.         CrntView[i][j] = j == 2 ? -IritCrntView[i][j]
  557.                     : IritCrntView[i][j];
  558.  
  559.     replace_matrix3d(GlblFilDes, CrntView);
  560.  
  561.     IGDrawObject(PObj);
  562.     }
  563.  
  564.     if (IGGlblDoDoubleBuffer)
  565.     dbuffer_switch(GlblFilDes, !CurrentDisplay);
  566.     else
  567.         flush_buffer(GlblFilDes);
  568.  
  569.     CurrentDisplay = !CurrentDisplay;
  570. }
  571.  
  572. /*****************************************************************************
  573. * DESCRIPTION:                                                               M
  574. * Handles redraw of view window event.                                       M
  575. *                                                                            *
  576. * PARAMETERS:                                                                M
  577. *   None                                                                     M
  578. *                                                                            *
  579. * RETURN VALUE:                                                              M
  580. *   void                                                                     M
  581. *****************************************************************************/
  582. void IGHandleInternalEvents(void)
  583. {
  584. }
  585.